(function(){
  var pd = Vue.component('progess-dialog', {
    template: '<div v-cloak><el-dialog ref="dg" :visible.sync="dialogVisible" :close-on-press-escape="false" width="160px" :close-on-click-modal="false" :show-close="false"><el-progress type="circle" :percentage="value"></el-progress></el-dialog></div>',
    data: function () {
      return {
        dialogVisible: false,
        value: 0
      }
    }, 
    mounted: function(){
      this.$refs.dg.$el.querySelector(".el-dialog__header").setAttribute("style", "display:none;")
    },    
    methods: {
      show: function(n){
        if(n === false) {
          this.dialogVisible = false;
          var that = this;
          setTimeout(function(){that.value=0;}, 300)
        }
        else {
          n = n > 100 ? 100: n;
          n = n < 0 ? 0 : n;
          this.dialogVisible = true;
          this.value = n;
        }
      },
    }
  })    
  var object = new pd()
  object.$mount()
  document.body.appendChild(object.$el)
  Vue.prototype.$showProgress = object.show  
})()

